package com.edu.service.impl;

import com.edu.service.BookService;

import java.util.Date;

/**
 * @Author:zyn
 * @Date:2025/11/10--15:31:10
 */
public class BookServiceProxy implements BookService {
    private BookService bookService;

    public BookServiceProxy(BookService bs){
        this.bookService=bs;
    }

    @Override
    public void addBook() {
        long start=System.currentTimeMillis();
        bookService.addBook();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);
    }

    @Override
    public void deleteBook() {
        long start=System.currentTimeMillis();
        bookService.deleteBook();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);
    }

    @Override
    public void updateBook() {
        long start=System.currentTimeMillis();
        bookService.updateBook();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);
    }

    @Override
    public void selectBook() {
        long start=System.currentTimeMillis();
        bookService.selectBook();
        try {
            Thread.sleep(3000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end=System.currentTimeMillis();
        System.out.println(end-start);
    }
}
